parser grammar ExprParser;

options { tokenVocab=ExprLexer; }

root
    : expressions  EOF
    ;

expressions
    : (expression  SEMI? )*
    ;

expression: assignment | simpleExpression;

assignment: (VAR | LET) ID EQUAL simpleExpression;
//assignment: VAR ID EQUAL simpleExpression;

simpleExpression
    : simpleExpression (PLUS | MINUS) simpleExpression
    | simpleExpression (MULTIPLY | DIVIDE) simpleExpression
    | variableRef
    | functionRef
    | number
;

number: NUM+;
variableRef: ID;
functionRef: ID OPEN_PAR CLOSE_PAR;
